<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>div模拟textarea</title>
    <style>
        div.text {
            width: 400px;
            min-height: 100px;
            max-height: 300px;
            margin: 50px auto;
            padding: 3px;
            outline: none;
            border: 1px solid grey;
            font-size: 13px;
            word-wrap: break-word;
            overflow-x: hidden;
            overflow-y: auto;
        }
    </style>
</head>
<body>
    <div class="text" contenteditable="true"></div>
</body>
</html>
